package com.cloudsigns.factorymanager2.engineering.presenter;

import com.cloudsigns.factorymanager2.engineering.IView.IpatrolCompletionOrderSureView;
import com.cloudsigns.factorymanager2.engineering.model.IPatrolCompletionOrderSureModel;
import com.cloudsigns.factorymanager2.engineering.model.PatrolCompletionOrderSureModel;

public class PatrolCompletionOrderSurePresenter {
    private IpatrolCompletionOrderSureView view;
    private IPatrolCompletionOrderSureModel model;
    private android.os.Handler mHandler = new android.os.Handler();

    public PatrolCompletionOrderSurePresenter(IpatrolCompletionOrderSureView view) {
        this.view = view;
        this.model = new PatrolCompletionOrderSureModel();
    }

    public void patrolCompletionOrderSure() {


        model.patrolCompletionOrderSure(view.getassignReceiveOrderId(), view.getOderId(),
                new PatrolCompletionOrderSureModel.OnPatrolCompletionOrderSureListener() {
                    @Override
                    public void patrolCompletionOrderSureSunccessed() {
                        //需要在UI线程执行
                        mHandler.post(new Runnable() {
                            @Override
                            public void run() {
                                view.patrolCompletionOrderSureSuccessed();
                                view.hideLoading();
                            }
                        });
                    }

                    @Override
                    public void patrolCompletionOrderSureFailed(final String desc) {
                        //需要在UI线程执行
                        mHandler.post(new Runnable() {
                            @Override
                            public void run() {
                                view.patrolCompletionOrderSureFailed(desc);
                                view.hideLoading();
                            }
                        });
                    }
                });

    }
}
